| Conditions | 1 |
| Paths | 1 |
| Total Lines | 51 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | /** |
||
| 10 | constructor (client) { |
||
| 11 | /** |
||
| 12 | * is it a command |
||
| 13 | * @name FisherRequest#isCommand |
||
| 14 | * @type {boolean} |
||
| 15 | * @default false |
||
| 16 | * @readonly |
||
| 17 | */ |
||
| 18 | this.isCommand = false |
||
| 19 | /** |
||
| 20 | * the command if there is one |
||
| 21 | * @name FisherRequest#command |
||
| 22 | * @type {Command} |
||
| 23 | * @default null |
||
| 24 | */ |
||
| 25 | this.command = null |
||
| 26 | /** |
||
| 27 | * the register of the command |
||
| 28 | * @name FisherRequest#register |
||
| 29 | * @type {FisherRegister} |
||
| 30 | * @default null |
||
| 31 | */ |
||
| 32 | this.register = null |
||
| 33 | /** |
||
| 34 | * the prefix trigered |
||
| 35 | * @name FisherRequest#prefix |
||
| 36 | * @type {string} |
||
| 37 | * @default null |
||
| 38 | */ |
||
| 39 | this.prefix = null |
||
| 40 | /** |
||
| 41 | * The discord.js channel |
||
| 42 | * @name FisherRequest#channel |
||
| 43 | * @type {GuildChannel} |
||
| 44 | * @default null |
||
| 45 | */ |
||
| 46 | this.channel = null |
||
| 47 | /** |
||
| 48 | * The dicord.js message |
||
| 49 | * @name FisherRequest#message |
||
| 50 | * @type {Message} |
||
| 51 | * @default null |
||
| 52 | */ |
||
| 53 | this.message = null |
||
| 54 | /** |
||
| 55 | * The Fisherman client |
||
| 56 | * @name FisherRequest#client |
||
| 57 | * @type {Fisherman} |
||
| 58 | */ |
||
| 59 | Object.defineProperty(this, 'client', { value: client }) |
||
| 60 | } |
||
| 61 | } |
||
| 63 |